import { defineComponent, h, ref, computed } from '@vue/runtime-core'
import StartPage from './page/StartPage'
import GamePage from './page/GamePage'
import EndPage from './page/EndPage'
export default defineComponent({
  setup(props, ctx) {
    const currentNamePage = ref('StartPage')
    const currentPage = computed(() => {
      switch (currentNamePage.value) {
        case 'StartPage':
          return StartPage
          break
        case 'GamePage':
          return GamePage
          break
        case 'EndPage':
          return EndPage
          break
      }
    })
    return {
      currentPage,
      currentNamePage
    }
  },
  render(ctx) {
    return h('Container', [
      h(ctx.currentPage, {
        onChangePage(page) {
          ctx.currentNamePage = page
        }
      })
    ])
  }
})
